<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models\Base;

use Carbon\Carbon;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class WorkTicket
 *
 * @property int $id
 * @property string $code 工单编号
 * @property int $school_id 学校id
 * @property int $school_user_id 学校用户id
 * @property string $room_number 房间号
 * @property string $contact_name 联系人
 * @property string $contact_tel 联系人电话
 * @property string $content 工单内容
 * @property int|null $work_user_id 维护人员id
 * @property int|null $admin_user_id 客服id
 * @property int $status 状态|100：待处理,101：处理中,102：已处理,103：已取消
 * @property \Illuminate\Support\Carbon|null $finish_at 完成时间
 * @property \Illuminate\Support\Carbon|null $cancel_at 取消时间
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket query()
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereAdminUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereCancelAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereCode($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereContactName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereContactTel($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereContent($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereFinishAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereRoomNumber($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereSchoolId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereSchoolUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereStatus($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket whereWorkUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket withTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|WorkTicket withoutTrashed()
 * @mixin \Eloquent
 */
class WorkTicket extends Model
{
	use SoftDeletes;
	use HasDateTimeFormatter;
	const ID = 'id';
	const CODE = 'code';
	const SCHOOL_ID = 'school_id';
	const SCHOOL_USER_ID = 'school_user_id';
	const ROOM_NUMBER = 'room_number';
	const CONTACT_NAME = 'contact_name';
	const CONTACT_TEL = 'contact_tel';
	const CONTENT = 'content';
	const WORK_USER_ID = 'work_user_id';
	const ADMIN_USER_ID = 'admin_user_id';
	const STATUS = 'status';
	const FINISH_AT = 'finish_at';
	const CANCEL_AT = 'cancel_at';
	const CREATED_AT = 'created_at';
	const UPDATED_AT = 'updated_at';
	const DELETED_AT = 'deleted_at';
	protected $table = 'work_tickets';

	protected $casts = [
		self::ID => 'int',
		self::SCHOOL_ID => 'int',
		self::SCHOOL_USER_ID => 'int',
		self::WORK_USER_ID => 'int',
		self::ADMIN_USER_ID => 'int',
		self::STATUS => 'integer',
		self::FINISH_AT => 'datetime',
		self::CANCEL_AT => 'datetime',
		self::CREATED_AT => 'datetime',
		self::UPDATED_AT => 'datetime'
	];
}
